The present invention relates to a memory control apparatus for executing control of operations such as writing of data into a non-volatile memory device such as a flash memory and reading out of data from such a memory device, relates to a memory control method adopted by the memory control apparatus as well as relates to a program to be executed by the memory control apparatus to implement the memory control method.
In recent years, as removable media, there is known a compact storage apparatus (or a semiconductor storage apparatus), which is provided with a non-volatile semiconductor memory device such as a flash memory and is capable of writing and reading out various kinds of data into and from the memory device.
The flash memory employed in such a semiconductor storage apparatus is known to have characteristics of not allowing already stored data to be overwritten and requiring that new data be written into an area from which data has already been erased. In addition, data is erased from the flash memory in block units each having a predetermined size to serve as a smallest unit of a physical storage area. On the other hand, data is written into a block in the flash memory in page units each having a predetermined size to serve as a smallest unit of the block of a storage area. Furthermore, the life of the flash memory is determined by the number of erase operations repeated so far. For this reason, data is written or existing data is updated as follows.
Let us assume for example that user data is written into the flash memory as an update. In this case, data is read out from a block in which the data to be updated has been stored, and the data read out from the block as well as additional data used as an update are used to generate updated data. Then, the updated data is written into another specific block from which data has been erased at this stage. Finally, data is erased from the block in which the data to be updated has been stored.
That is to say, when data is updated, the additional data used as an update is not written into the block in which the data to be updated has been stored. Instead, another specific block from which data has been erased is selected as a block into which the updated data is written in the so-called an alternate-block process. An effort is made to prevent erase and write operations from being carried out repeatedly and consecutively on a block during the same period of time so as to lengthen the life of the flash memory.
In addition, in order to execute data management with a high degree of efficiency for an operation to update data as described above, a file system introduces the concept of logical and physical addresses used in management of blocks. By adopting the concept of logical and physical addresses, data is written into and read out from the storage apparatus in block units. To put it concretely, the file system includes a logical-physical address conversion table, which is a table showing pairs each composed of a logical address and a physical address corresponding to the logical address. The logical-physical address conversion table is used as a table showing management information used for managing status indicating whether or not data has been written in each block in the flash memory. That is to say, by referring to this logical-physical address conversion table, for example, an access can be made to the flash memory through a FAT (File Allocation Table) in the same mechanism as the conventional one. The FAT is a table at a higher level in the file system.
After data is updated as described above, the logical-physical address conversion table is also updated to reflect results of the operations to update data of an actual block and erase the data from the block.
By the way, we naturally assume that, in the course of a data-writing process carried out to typically update data already stored in the flash memory, for example, the power supply may be interrupted or the semiconductor storage apparatus may be pulled out from the drive so that the data-writing process is discontinued.
In such a case, for example, when the semiconductor storage apparatus is activated again later, the storage status of physical data in the actual flash memory may not match the management information stored typically in the logical-physical address conversion table. With the storage status of physical data in the actual flash memory not matching the management information, in subsequent operations, normal data management and data accesses to the flash memory cannot be guaranteed.